<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<base th:href="@{/}">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>登录医保贷系统</title>
<div th:insert ="~{common::header}"></div>
<link rel="stylesheet" th:href="@{css/login.css}">
  <script type="text/javascript" th:src="@{/common/jedate/jedate.js}"></script>
  <script type="text/javascript" th:src="@{/common/md5.js}"></script>
</head>

<div class="login_container">
  <aside>
    <!-- <video autoplay="autoplay" preload="auto" muted="muted" style="width: 100%; height: 100vh; object-fit: cover; object-position: center bottom;" playsinline="true" webkit-playsinline="true" src="images/hh0013.mp4"></video> -->
    <img src="images/asideImg.png" alt="" />
  </aside>
  <div class="login_box">
    <!-- 头像区域 -->
    <div class="avatar_box">
      <img src="images/logo.png" alt="" />
    </div>
    <h2 th:text="#{app.name}">医保贷平台</h2>
    <!-- 登录表单区 -->
    <form id="form" class="login_form" th:action="@{/login/login}" method="post">
      <div class="d-flex mt-2 mb-4">
        <i class="mdi mdi-account"></i>
        <input type="text" id="username" name="username" placeholder="请输入用户名" class="input_inner" />
      </div>
      <div class="d-flex mb-4">
        <i class="mdi mdi-lock"></i>
        <input type="password" id="password" name="password" placeholder="请输入密码" class="input_inner" />
        <input type="hidden" name="passwordMd5" id="passwordMd5"/>
      </div>
      <div class="d-flex mb-4 vcodeBox">
        <i class="mdi mdi-security"></i>
        <input type="text" id="vcode" name="vcode" placeholder="验证码" value="1111" class="input_inner" />
        <img id="captcha" class="captcha" th:src="@{/captcha}"/>
      </div>
      <!-- 按钮区域 -->
      <div class="btns mb-4">
        <input name="errMsg"  id="errMsg"  type="hidden" th:value="${errMsg }" />  
        <input class="btn btn-block btn-primary btn-lg mr-0" type="submit" value="登 录" />
      </div>
      <div class="changeLang">
        <a href="javascript:;" onclick="changeLang('zh')"> 中文 </a>
		    <a href="javascript:;" onclick="changeLang('en')"> English </a>
      </div>
    </form>
  </div>
</div>
</body>
<script type="text/javascript">
	$(document).ready(function(){

		$("#captcha").click(function(e){this.src = "captcha?t="+Math.random()});
		
		$("#form").submit(function(){
			
			var username=$("#username").val();
			
			if(null==username || ''==username){
				alert('请输入用户名');
				return false;
			}
				
			var password=$("#password").val();
			var zmd5 = "";
			var pmd5 = hex_md5(password);
			for(var i=0; i<pmd5.length; i++){
				var t = pmd5.charCodeAt(i)-7;
				var a = String.fromCharCode(parseInt(t/10)+100);
				var b = String.fromCharCode(t%10+100);
				zmd5 += a+""+b;
			}
			$("#passwordMd5").val(zmd5);
			return true;
		})
		
	
	   	var errMsg=$("#errMsg").val();
	   	if(errMsg){
			window.setTimeout(function(){alert(errMsg)},500);
		}
	})
    
	
	
function changeLang(lang){ 
	document.cookie="ClientLanguage="+lang; 
	location.reload(); 
} 
</script> 
</html>
